package main

import (
    "beego_background_framework/controllers"
    _ "beego_background_framework/routers"
    "beego_background_framework/sysinit"
    _ "beego_background_framework/sysinit"
    "github.com/astaxie/beego"
    //"github.com/beego/i18n"
)

func main() {
    //开启session
    beego.BConfig.WebConfig.Session.SessionOn = true

    //自定义模板函数
    _ = beego.AddFuncMap("list_id_search", sysinit.ListIdSearch)
    _ = beego.AddFuncMap("list_in_slice", sysinit.ListInSlice)
    //_ = beego.AddFuncMap("i18n", i18n.Tr)

    //过滤器：加日志
    beego.InsertFilter("/admin/*",beego.BeforeRouter, sysinit.FilterAddLog)

    //后台权限过滤
    beego.InsertFilter("/admin/*",beego.BeforeRouter, sysinit.FilterAdminPermission)

    //自定义错误页面
    beego.ErrorController(&controllers.ErrorController{})

    beego.Run()
}

